SELECT FORMMAIN_1317."ID",ORG_MEMBER.CODE usercode,"TO_CHAR"(FORMMAIN_1317.FIELD0008,'yyyy-mm-dd hh24:mi:ss') glbdef1,
series.ENUMVALUE glbdef3, FORMMAIN_1317.FIELD0028 glbdef4,grade.ENUMVALUE glbdef5,
FORMMAIN_1317.FIELD0031 glbdef7,CASE WHEN flag.ENUMVALUE = 0 THEN 'Y' ELSE 'N' END glbdef8 
FROM COL_SUMMARY
LEFT JOIN FORMMAIN_1317 ON FORMMAIN_1317."ID" = COL_SUMMARY.FORM_RECORDID
LEFT JOIN ORG_MEMBER ON ORG_MEMBER."ID" = FORMMAIN_1317.FIELD0001
LEFT JOIN CTP_ENUM_ITEM series ON series."ID" = FORMMAIN_1317.FIELD0032
LEFT JOIN CTP_ENUM_ITEM grade ON grade."ID" = FORMMAIN_1317.FIELD0033
LEFT JOIN CTP_ENUM_ITEM flag ON flag."ID" = FORMMAIN_1317.FIELD0030
WHERE COL_SUMMARY."ID" = '${id}'